package main

import "math"

func main() {
	print(FindLongestSeq([]int{1, 4, 2, 6, 9}))
}

func FindLongestSeq(nums []int) int {
	// 初始化数据为1
	dp := make(map[int]int, len(nums))
	for a := range nums {
		dp[a] = 1
	}
	for i := 0; i < len(nums); i++ {
		for j := 0; j < i; j++ {
			if nums[i] > nums[j] {
				dp[i] = int(math.Max(float64(dp[i]), float64(dp[j]+1)))
			}
		}
	}
	res := 0
	for _, v := range dp {
		res = int(math.Max(float64(res), float64(v)))
	}
	return res
}
